import request from '../request'

// 添加订单
export const saveOrder = (data) => {
  return request({
    url: '/order',
    method: 'POST',
    data
  })
}

// 查询订单
export const queryOrder = (uid, status) => {
  return request({
    url: `/order/${uid}/${status}`
  })
}

// 根据id查询订单
export const queryOrderById = (oid) => {
  return request({
    url: `/order/${oid}`
  })
}

// 支付订单
export const pay = (data) => {
  return request({
    url: `/order/pay`,
    method: 'POST',
    data
  })
}

// 取消订单
export const cancel = (data) => {
  return request({
    url: `/order/cancel`,
    method: 'POST',
    data
  })
}

// 删除订单
export const delCart = (id) => {
  return request({
    url: `/order/${id}`,
    method: 'DELETE'
  })
}
